package com.fbs.demo1114.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface BookShopDao {

    @Select("select price from book where isbn=#{isbn}")
    public int findBookPriceByIsbn(String isbn);

    @Update("update book_stock set stock=stock-1 where isbn=#{isbn}")
    public void updateBookStock(String isbn);



    @Update("update account set balance=balance-#{money} where username=#{username}")
    public void updateAccount(@Param("username") String username, @Param("money") int money);



    @Select("select stock from book_stock where isbn=#{isbn}")
    public int findStockByIsbn(String isbn);


    @Select("select balance from account where username=#{username}")
    public int findBalanceByUsername(String username);
}

